package com.example.demo.use;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;

@SpringBootApplication
public class ScopeApplication {
    public static void main(String[] args) {

        ConfigurableApplicationContext context = SpringApplication.run(ScopeApplication.class, args);

        UserRepositoryImpl userRepositoryImpl1 = (UserRepositoryImpl)context.getBean("userRepositoryImpl");
        UserRepositoryImpl userRepositoryImpl2 = (UserRepositoryImpl)context.getBean("userRepositoryImpl");
        System.out.println("@Repository注解默认作用域为singleton，返回true： " + userRepositoryImpl1.equals(userRepositoryImpl2));
    }
}